package com.wwq.websocket.demo2.websocketdemo2.controller;

import com.wwq.websocket.demo2.websocketdemo2.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class WebSocketController {
    @Autowired
    private WebSocketService ws;

    @RequestMapping("/Welcome1")
    @ResponseBody
    public String say2()throws Exception
    {
        ws.sendMessage();
        return "is ok";
    }

    @GetMapping("ws")
    public String getView() {
        return "ws";
    }
}